package fdoj.eventInvitations.dao;

import java.util.List;

import javax.ejb.Local;
import javax.ejb.Stateless;
import javax.persistence.NoResultException;
import javax.persistence.Query;

import fdoj.eventInvitations.entity.Event;
import fdoj.eventInvitations.entity.Invantation;
@Stateless
@Local(InvantationDao.class)
/**
 * Klasa koja implementira CRUD operacije za entitet {@link Invantation} 
 */
public class InvantationDaoBean extends GenericDaoBean<Invantation, Integer> implements InvantationDao{
	public List<Invantation> invitationByReceiver(String email){
		List<Invantation> retVal=null;
		try{
			Query q=em.createQuery("SELECT i FROM Invantation i WHERE i.eventCall.email=:email");
			q.setParameter("email", email);
			retVal=(List<Invantation>)q.getResultList();
		}catch(NoResultException ex){
			
		}
		return retVal;
	}
}
